<?php
/**
 * 资源连接池
 * @author yubing
 */
class pool {
    /**
     * 数据库链接池
     */
    public static function db($config='db',$hash=0){
        static $db;  
        $conf = config::$$config;
        $index = abs($hash) % count($conf['dsn']);
        //重新初始化数据库连接
        if(!isset($db[$config][$index]) || !is_resource($db[$config][$index])){
            $db[$config][$index] = new db($config,$hash);
        }
        return $db[$config][$index]; 
    }
    public static function memcache(){
        static $memcache;
    }
}